package com.woniu.job.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.woniu.job.entity.PageBean;
import com.woniu.job.entity.Resumework;
import com.woniu.job.mapper.ResumeworkMapper;
import com.woniu.job.service.IResumeworkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author song
 * @since 2019-12-24
 */
@Service
public class ResumeworkServiceImpl extends ServiceImpl<ResumeworkMapper, Resumework> implements IResumeworkService {
    @Autowired
    private ResumeworkMapper resumeworkMapper;
    @Override
    public PageBean<Resumework> getResumeByCompany(String companyId, Integer page) {
        int pageSize = 2;
        Page p = PageHelper.startPage(page,pageSize);
        PageBean<Resumework> resumeworkPageBean = new PageBean<>();
        resumeworkPageBean.setData(resumeworkMapper.getResumeByCompany(companyId));
        resumeworkPageBean.setCurrPage(page);
        resumeworkPageBean.setTotalPage(p.getPages());
        resumeworkPageBean.setCurrNum(p.getPageSize());
        resumeworkPageBean.setTotalNum((int)p.getTotal());
        resumeworkPageBean.setPageSize(pageSize);
        return resumeworkPageBean;
    }
}
